<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<title>prepend(content)</title>

<!-- KUI -->
<link rel="stylesheet" href="../../../style/kelat.css" media="all"/>
<!-- 扩展样式 -->
<link rel="stylesheet" href="../../../style/theme.css" media="all"/>

</head>
<body >
<div>
   <div class="HelpBox">
   
    <h2><span>返回值:kelat</span>prepend(content)</h2>
    <h3>概述</h3>
    <div class="desc">
      <p>向每个匹配的元素内部前置内容。</p>
      <div class="longdesc">
        <p>这是向所有匹配元素内部的开始处插入内容的最佳方式。</p>
      </div>
    </div>
    <h3>参数</h3>
    <div class="parameter">
      <h4><strong>content</strong><span>String, Element</span></h4>
      <p>要插入到目标元素内部前端的内容</p>
    </div>
    <div class="example">
      <h3>示例</h3>
      <span id="f_ad2"></span>
      <h4>描述:</h4>
      <p>向所有段落中前置一些HTML标记代码。</p>
      <h5>HTML 代码:</h5>
      <pre><code>&lt;p&gt;I would like to say: &lt;/p&gt;</code></pre>
      <h5>js 代码:</h5>
      <pre><code>$$("p").prepend("&lt;b&gt;Hello&lt;/b&gt;");</code></pre>
      <h5>结果:</h5>
      <pre><code>[ &lt;p&gt;&lt;b&gt;Hello&lt;/b&gt;I would like to say: &lt;/p&gt; ]</code></pre>
      <h4>描述:</h4>
      <p>将一个DOM元素前置入所有段落</p>
      <h5>HTML 代码:</h5>
      <pre><code>&lt;p&gt;I would like to say: &lt;/p&gt;
&lt;p&gt;I would like to say: &lt;/p&gt;
&lt;b class="foo"&gt;Hello&lt;/b&gt;
&lt;b class="foo"&gt;Good Bye&lt;/b&gt;</code></pre>
      <h5>js 代码:</h5>
      <pre><code>$$("p").prepend( $$(".foo")[0] );</code></pre>
      <h5>结果:</h5>
      <pre><code>&lt;p&gt;&lt;b class="foo"&gt;Hello&lt;/b&gt;I would like to say: &lt;/p&gt;
&lt;p&gt;&lt;b class="foo"&gt;Hello&lt;/b&gt;I would like to say: &lt;/p&gt;
&lt;b class="foo"&gt;Good Bye&lt;/b&gt;</code></pre>
      <h4>描述:</h4>
      <p>向所有段落中前置一个kelat对象(类似于一个DOM元素数组)。</p>
      <h5>HTML 代码:</h5>
      <pre><code>&lt;p&gt;I would like to say: &lt;/p&gt;&lt;b&gt;Hello&lt;/b&gt;</code></pre>
      <h5>js 代码:</h5>
      <pre><code>$$("p").prepend( $$("b") );</code></pre>
      <h5>结果:</h5>
      <pre><code>&lt;p&gt;&lt;b&gt;Hello&lt;/b&gt;I would like to say: &lt;/p&gt;</code></pre>
    </div>

</div>

</div>
</body>
</html>
